const { DataTypes } = require("sequelize");
const sequelize = require("../connect"); // Adjust the path as necessary

const User = sequelize.define(
  "User",
  {
    id: {
      type: DataTypes.INTEGER,
      autoIncrement: true,
      primaryKey: true,
    },
    desc: {
      type: DataTypes.STRING(191),
    },
    name: {
      type: DataTypes.STRING(191),
    },
    phone: {
      type: DataTypes.STRING(191),
      allowNull: false,
      unique: true,
    },
    avatar: {
      type: DataTypes.STRING(191),
    },
    recordedAt: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW,
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW,
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW,
    },
  },
  {
    tableName: "users",
    timestamps: false,
  }
);

module.exports = User;
